const express = require('express');
const router = express.Router();
const { auth } = require('../middleware/auth');
const upload = require('../middleware/upload');
const {
  getScams,
  getScam,
  createScam,
  updateScam,
  deleteScam
} = require('../controllers/scamController');

// 获取骗子列表
router.get('/', getScams);

// 获取单个骗子信息
router.get('/:id', getScam);

// 创建骗子信息
router.post('/', auth, upload.array('evidence', 5), createScam);

// 更新骗子信息
router.put('/:id', auth, upload.array('evidence', 5), updateScam);

// 删除骗子信息
router.delete('/:id', auth, deleteScam);

module.exports = router; 